home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / FPGAWKII.ZIP / LEDDECOD.PDS < prev    next >
Text File  |  1994-10-05  |  3KB  |  73 lines

  1. ;---------------------------------------------------------
  2. ; This design decodes a 4-bit number into 7 signals which
  3. ; can drive a 7-segment LED digit.  The LEDs in the digit
  4. ; should light in a pattern that represents the number.
  5. ;---------------------------------------------------------
  6. TITLE   7-segment led decoder
  7.  
  8. CHIP    leddecod    NFX780_84
  9.  
  10.  
  11. ;---------------------------------------------------------
  12. ; Inputs and outputs for the LED decoder
  13. ;---------------------------------------------------------
  14.  
  15. ;* This is the 4-bit input to the LED decoder
  16. PIN     47   d0    ;* least-significant bit (LSB)
  17. PIN     48   d1
  18. PIN     49   d2
  19. PIN     50   d3    ;* most-significant bit (MSB)
  20. PIN     51   unused0
  21. PIN     77   unused1
  22. PIN     78   unused2
  23.  
  24. ;* These are the pins that drive the LED segments
  25. PIN     34   s0    ;*  +----s6---+
  26. PIN     35   s1    ;*  |         |
  27. PIN     36   s2    ;* s5         s4
  28. PIN     37   s3    ;*  |         |
  29. PIN     39   s4    ;*  +----s3---+
  30. PIN     40   s5    ;*  |         |
  31. PIN     41   s6    ;* s2         s1
  32.                    ;*  |         |
  33.                    ;*  +----s0---+
  34.  
  35.  
  36. ;---------------------------------------------------------
  37. ; Below is the truth table for driving the LEDs given the
  38. ; 4-bit number.  A 1 on an output will make the
  39. ; corresponding LED segment light up; a 0 will make the
  40. ; segment stay dark. The truth-table gives the appropriate
  41. ; outputs to light the LED segments for the digits 0--9.
  42. ;---------------------------------------------------------
  43.  
  44. T_TAB ( d3 d2 d1 d0  >>  s0 s1 s2 s3 s4 s5 s6 ) 
  45.          0  0  0  0   :   1  1  1  0  1  1  1   ;* 0
  46.          0  0  0  1   :   0  1  0  0  1  0  0   ;* 1
  47.          0  0  1  0   :   1  0  1  1  1  0  1   ;* 2
  48.          0  0  1  1   :   1  1  0  1  1  0  1   ;* 3
  49.          0  1  0  0   :   0  1  0  1  1  1  0   ;* 4
  50.          0  1  0  1   :   1  1  0  1  0  1  1   ;* 5
  51.          0  1  1  0   :   1  1  1  1  0  1  1   ;* 6 
  52.          0  1  1  1   :   0  1  0  0  1  0  1   ;* 7
  53.          1  0  0  0   :   1  1  1  1  1  1  1   ;* 8
  54.          1  0  0  1   :   1  1  0  1  1  1  1   ;* 9
  55.  
  56.  
  57. ;---------------------------------------------------------
  58. ; Simulate the LED decoder
  59. ;---------------------------------------------------------
  60. SIMULATION
  61.         TRACE_ON d0 d1 d2 d3 s0 s1 s2 s3 s4 s5 s6
  62.         SETF /d3 /d2 /d1 /d0    ;* digit = "0"
  63.         SETF /d3 /d2 /d1  d0    ;* digit = "1"
  64.         SETF /d3 /d2  d1 /d0    ;* digit = "2"
  65.         SETF /d3 /d2  d1  d0    ;* digit = "3"
  66.         SETF /d3  d2 /d1 /d0    ;* digit = "4"
  67.         SETF /d3  d2 /d1  d0    ;* digit = "5"
  68.         SETF /d3  d2  d1 /d0    ;* digit = "6"
  69.         SETF /d3  d2  d1  d0    ;* digit = "7"
  70.         SETF  d3 /d2 /d1 /d0    ;* digit = "8"
  71.         SETF  d3 /d2 /d1  d0    ;* digit = "9"
  72.  
  73.